# !usr/bin/env python
# -*- coding:utf-8 _*-
"""
@Author:张广勤
@Web site: https://www.tunan.wang
@Github:www.github.com
 
@File:enumerate1_0.py
@Time:2024/9/19 21:02

@Motto:不积跬步无以至千里，不积小流无以成江海！
"""

fruits = ['apple', 'banana', 'cherry']
print(enumerate(fruits,1))
print(type(enumerate(fruits,1)))#<class 'enumerate'>
print(list(enumerate(fruits,1)))#[(1, 'apple'), (2, 'banana'), (3, 'cherry')]
print(reversed(list(enumerate(fruits,1))))#<list_reverseiterator object at 0x00000000026A6A60>#列表反转对象
print(list(reversed(list(enumerate(fruits,1)))))#[(3, 'cherry'), (2, 'banana'), (1, 'apple')]
for index, fruit in enumerate(fruits, start=1):
    print(f"The fruit at index {index} is {fruit}")

